﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TTServer
{
    public partial class FormSetPort : Form
    {
        private FormSetPort()
        {
            InitializeComponent();
        }

        private FormTTServerGUI formTTServerGUI;


        public FormSetPort(FormTTServerGUI formTTServerGUI)
        {
            this.formTTServerGUI = formTTServerGUI;
            InitializeComponent();

        }

        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                int port = int.Parse(txtPort.Text);

                formTTServerGUI.SetPort(port);

                MessageBox.Show("The server port has been changed.", "Notice");
                
                this.Close();
            }
            catch
            {
                MessageBox.Show("Please try another port", "Notice");
            }
        }
    }
}
